import { Button, Empty } from "antd";
import { FC } from "react";
import { history } from "umi";
const EmptyData: FC<any> = (props) => {
  const { venueStatus, venueList, roomList, venueObj, onVenue, dimension } =
    props;
  return (
    <div>
      {!venueStatus && (
        <Empty
          image={Empty.PRESENTED_IMAGE_SIMPLE}
          description={
            <div>
              场馆数据请求异常 <br />
              <Button
                style={{ marginTop: "10px" }}
                type="primary"
                onClick={() => {
                  onVenue();
                }}
              >
                刷新场馆
              </Button>
            </div>
          }
        />
      )}
      {venueStatus && venueList.length == 0 && (
        <Empty
          image={Empty.PRESENTED_IMAGE_SIMPLE}
          description={
            <div>
              暂未创建场馆 <br />
              <Button
                style={{ marginTop: "10px" }}
                type="primary"
                onClick={() => {
                  history.push("/stadium/list");
                }}
              >
                去创建场馆
              </Button>
            </div>
          }
        />
      )}
      {venueStatus && venueList.length > 0 && !venueObj.id && (
        <Empty
          image={Empty.PRESENTED_IMAGE_SIMPLE}
          description={
            <div>
              暂无数据 <br /> 请先选择场馆
            </div>
          }
        />
      )}
      {venueList.length > 0 &&
        venueObj.id &&
        roomList.length == 0 &&
        dimension == "date" && (
          <Empty
            image={Empty.PRESENTED_IMAGE_SIMPLE}
            description={
              <div>
                当前场馆下暂无关联教室 <br />
                <Button
                  style={{ marginTop: "10px" }}
                  type="primary"
                  onClick={() => {
                    history.push("/stadium/classroom");
                  }}
                >
                  去创建教室并且关联到{venueObj.venueName}
                </Button>
              </div>
            }
          />
        )}
    </div>
  );
};
export default EmptyData;
